import { defineConfig } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
import legacy from "@vitejs/plugin-legacy";
const pathResolve = (dir) => {
  return resolve(__dirname, ".", dir);
};
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    legacy({
      targets: ["defaults", "not IE 11"],
    }),
  ],
  base: "./",
  server: {
    host: "0.0.0.0",
    hmr: true,
    fs: {
      strict: false,
    },
    proxy: {
      "/h5": {
        target: "https://xcx.sskfyh.com/",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/h5/, ""),
      },
    },
  },
  resolve: {
    alias: {
      "@assets": pathResolve("./src/assets/"),
      "/@": pathResolve("./src/"),
    },
  },
});
